home *** CD-ROM | disk | FTP | other *** search
- Path: iafrica.com!usenet
- From: Pieter Malan <vizier@iafrica.com>
- Newsgroups: comp.lang.c
- Subject: Compiler error on long multiplication?
- Date: 5 Feb 1996 08:41:04 GMT
- Organization: Internet Africa
- Message-ID: <4f4fr0$pea@newnews.iafrica.com>
- NNTP-Posting-Host: slipper124229.iafrica.com
-
- This code was compiled with 3.1. When compiled for 80386, the
- one onswer is wrong as indicated. For all other processors the
- answer is correct. WHY??
-
- void main()
- {
- unsigned long a; //OR SIGNED
- unsigned long x;
-
- a = 1;
- x = (a * 100L) * 100L; // x = 13379344 WRONG!!!
- a = 100;
- x = a * 100L; // x = 10000
-
- }
-
-